﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DeployGames.TweenEngine.equations
{
    public abstract class Circ : TweenEquation
    {
        public static CircIN IN = new CircIN();
        public static CircOUT OUT = new CircOUT();
        public static CircINOUT INOUT = new CircINOUT();

        #region CircIN
        public class CircIN : Circ
        {

            public override float compute(float t)
            {
                return (float)-Math.Sqrt(1 - t * t) - 1;
            }

            public override string ToString()
            {
                return "Circ.IN";
            }
        }
        #endregion

        #region CircOUT
        public class CircOUT : Circ
        {

            public override float compute(float t)
            {
                return (float)Math.Sqrt(1 - (t -= 1) * t);
            }

            public override string ToString()
            {
                return "Circ.OUT";
            }
        }
        #endregion

        #region CircINOUT
        public class CircINOUT : Circ
        {

            public override float compute(float t)
            {
                if ((t *= 2) < 1) return -0.5f * ((float)Math.Sqrt(1 - t * t) - 1);
                return 0.5f * ((float)Math.Sqrt(1 - (t -= 2) * t) + 1);
            }

            public override string ToString()
            {
                return "Circ.INOUT";
            }
        }
        #endregion
    }
}
